/*
 * @Author: your name
 * @Date: 2020-05-18 19:57:58
 * @LastEditTime: 2021-10-07 00:45:03
 * @LastEditors: your name
 * @Description: In User Settings Edit
 * @FilePath: \generallib\general\src\pattern\factory.hpp
 */
//
// Created by 29019 on 2020/5/18.
//

#ifndef GENERAL_FACTORY_HPP
#define GENERAL_FACTORY_HPP
#include <string>
using  namespace  std;
template<typename T>
class Factory{
public:
    virtual T* GetProduct(std::string type){
        return nullptr;
    }
};
template<typename T>
class CloneAble{
public:
    virtual T* Clone(){
        return nullptr;
    }
};

template<typename T>
class Prototype{
public:
    Prototype(CloneAble<T> *s){
        mProto = s->Clone();
    }
    virtual T*GetProduct(){
        return mProto->Clone();
    }
private:
    CloneAble<T> *mProto;
    Prototype(){}
};
#endif //GENERAL_FACTORY_HPP
